package com.java110.mall.shop.cmd.shop;

import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.context.CmdContextUtils;
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.dto.shop.ShopDto;
import com.java110.mall.shop.bmo.shop.IGetShopBMO;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.BeanConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;

@Java110Cmd(serviceCode = "shop.queryNeedAuditShop")
public class QueryNeedAuditShopCmd extends Cmd {

    @Autowired
    private IGetShopBMO getShopBMOImpl;


    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
        super.validatePageInfo(reqJson);
    }

    @Override
    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
        String storeId = CmdContextUtils.getStoreId(context);
        ShopDto shopDto = BeanConvertUtil.covertBean(reqJson, ShopDto.class);
        // shopDto.setStoreId(storeId);
        shopDto.setState(ShopDto.STATE_F);
        ResponseEntity<String> responseEntity = getShopBMOImpl.getNeedAudiShop(shopDto);
        context.setResponseEntity(responseEntity);
    }
}
